package com.wcgksoft.controller.adminback;

import com.wcgksoft.common.util.MsgInfo;
import com.wcgksoft.entity.system.SysUser;
import com.wcgksoft.service.system.UserService;
import org.hibernate.criterion.DetachedCriteria;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * @author 御风
 * @version V1.0
 * @Package com.wcgksoft.controller.adminback
 * @Description TODO
 * @date 2020/6/3 14:39
 * @ClassName AdminStaticsController
 */
@Controller
@RequestMapping("adminback")
public class AdminStaticsController {

    @Autowired
    private UserService userService;

    /**
     * 查询总用户数
     * @return
     */
    @ResponseBody
    @RequestMapping(value = "findAllUser")
    public MsgInfo findAllUser(){
        MsgInfo msgInfo = new MsgInfo();
        DetachedCriteria criteria = DetachedCriteria.forClass(SysUser.class);
        List<SysUser> list = userService.findByConditions(criteria);
        msgInfo.setData(list.size());
        return msgInfo;
    }

}
